//package cn.apotato.dynamicdatascore.config.datasource;
//
//import com.alibaba.druid.pool.DruidDataSource;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Import;
//import org.springframework.context.annotation.Primary;
//
//import javax.sql.DataSource;
//
//@Import(MasterDataSourceProperties.class)
//@Configuration
//public class DataSourceConfig {
//
//    @Autowired
//    private MasterDataSourceProperties masterDataSourceProperties;
//
//    @Primary
//    @Qualifier
//    @Bean
//    public DataSource masterDataSource() {
//        // 配置主数据源
//        return buildDataSource();
//    }
//
//    private DataSource buildDataSource() {
//        DruidDataSource dataSource = new DruidDataSource();
//        dataSource.setDriverClassName(masterDataSourceProperties.getDriverClassName());
//        dataSource.setUrl(masterDataSourceProperties.getUrl());
//        dataSource.setUsername(masterDataSourceProperties.getUsername());
//        dataSource.setPassword(masterDataSourceProperties.getPassword());
//        return dataSource;
//    }
//}
//
